package com.yidian.service.impl;

import com.yidian.dto.CommentDTO;
import com.yidian.entity.Comment;
import com.yidian.mapper.CommentMapper;
import com.yidian.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("CommentService")
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentMapper commentMapper;
    private Object CommentDTO;

    @Override
    public List<Comment> getComments(Long commentId) {
        return commentMapper.selectCommentById(commentId);
    }

    @Override
    public void updateAddLikeCommentByCommentId(Long commentId) {
        commentMapper.updateAddLikeCommentByCommentId(commentId);
    }

    @Override
    public void updateDeleteLikeCommentByCommentId(Long commentId) {
        commentMapper.updateDeleteLikeCommentByCommentId(commentId);
    }

    @Override
    public List<CommentDTO> addComments(int commentId, int i) {
        return commentMapper.updateAddCommentByCommentId(commentId,-1);
    }
}
